package com.whmnx.my.ui.adapter;

import android.view.ViewGroup;


import androidx.annotation.NonNull;
import androidx.databinding.ViewDataBinding;

import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import com.whmnx.my.databinding.ItemViewpagerBinding;
import com.whmnx.my.ui.viewmodel.ViewPagerItemViewModel;

import me.tatarka.bindingcollectionadapter2.BindingViewPagerAdapter;

/**
 *
 * @author goldze
 * @date 2018/6/21
 */

public class ViewPagerBindingAdapter extends BindingViewPagerAdapter<ViewPagerItemViewModel> {


    @Override
    public void onBindBinding(final ViewDataBinding binding, int variableId, int layoutRes, int position, ViewPagerItemViewModel item) {
        super.onBindBinding(binding, variableId, layoutRes, position, item);
        //这里可以强转成ViewPagerItemViewModel对应的ViewDataBinding，
        ItemViewpagerBinding _binding = (ItemViewpagerBinding) binding;
        item.setBinding(_binding);

       // _binding.refresh.setOnRefreshListener(refreshLayout -> item.getSelorder(true));
      //  _binding.refresh.setOnLoadMoreListener(refreshLayout -> item.getSelorder(false));


    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        super.destroyItem(container, position, object);
    }
}
